import request from '@/utils/request'

export default {
  pageRole(){
    return request({
      url: `/user/pageRole/${current}/${limit}`,
      method: 'get',
    })
  },
  getUserListPage(current, limit, userQuery) {
    return request({
      url: `/user/pageUserCondition/${current}/${limit}`,
      method: 'post',
      // userQuery条件对象，后端使用RequestBody获取数据
      //data表示把对象转换成JSON进行传递到接口里
      data: userQuery
    })
  },
  deleteUserById(id) {
    return request({
      url: `/user/${id}`,
      method: 'delete'
    })
  },
  //添加用户
  addUser(user) {
    return request({
      url: `/user/addUser`,
      method: 'post',
      data: user
    })
  },
  //根据ID值获取用户信息
  getUserById(id) {
    return request({
      url: `/user/getUserById/${id}`,
      method: 'get',
    })
  },
  //修改用户信息
  updateUserInfo(user) {
    return request({
      url: `/user/updateUser`,
      method: 'post',
      data: user
    })
  }
}
